﻿@using ZoomLa.Model.Shop
@using ZoomLa.BLL.Shop
@using System.Data
@using Newtonsoft.Json
@model ZoomLaCMS.Models.Product.VM_Product
@{
    B_Shop_Present ptBll = new B_Shop_Present();
    string value = "";
    if (Model.proMod.ID > 0)
    {
        DataTable dt = ptBll.Sel(Model.proMod.ID);
        if (dt.Rows.Count > 0)
        {
            value = JsonConvert.SerializeObject(dt);
        }
    }
}
<div ng-controller="presentCtrl">
<div>
    @*<input type="button" class="btn btn-info" value="选择商品" onclick="present.sel();" />*@
    <input type="button"  class="btn btn-primary" value="新建促销活动" ng-click="add();"/>
    <input type="button" class="btn btn-info" value="{{item}}" ng-click="add(item);" ng-repeat="item in fastList track by $index" style="margin-right:5px;"/>
</div>
<div style="margin-top:5px;max-height:300px;overflow-y:auto;">
    <table class="table table-bordered table-striped">
        <tr>
            <td class="td_l">促销方式</td>
            <td class="td_l">活动名称</td>
            <td style="width:260px;">数量条件</td>
            <td>优惠逻辑</td>
            <td class="td_m">操作</td>
        </tr>
        <tr ng-repeat="item in list track by $index">
            <td>
                <select ng-model="item.W_Type" class="form-control">
                    <option ng-repeat="option in typeList" value="{{option.value}}" ng-selected="option.value==item.W_Type">{{option.text}}</option>
                </select>
            </td>
            <td>
                <input type="text" class="form-control" ng-model="item.Name"/>
            </td>
            <td>
                <div ng-show="item.W_Type!=2">
                    每购满<input type="text" ng-model="item.W_StartNum" class="form-control text_s" />件商品
                </div>
                <div ng-show="item.W_Type==2">
                    每购满两件商品
                </div>
            </td>
            <td>
                <div ng-show="item.W_Type==0">
                    赠送,商品ID:
                    <input type="text" class="form-control text_s" ng-model="item.P_ID" placeholder="商品ID" />
                    @*<input type="text" class="form-control text_s" ng-model="item.P_Name" placeholder="商品名" />*@
                    <input type="text" class="form-control text_s" ng-model="item.P_Num" />件
                </div>
                <div ng-show="item.W_Type==1">
                    折扣<input type="text" class="form-control text_xs" ng-model="item.P_Price"/>%
                </div>
                <div ng-show="item.W_Type==2">
                    第二件商品,折扣<input type="text" class="form-control text_xs" ng-model="item.P_Price"/>%
                </div>
            </td>
            <td><a href="javascript:;" ng-click="del(item);" class="btn btn-sm btn-danger"><i class="fa fa-trash-o"></i></a></td>
        </tr>
    </table>
    <input type="hidden" name="present_hid" id="present_hid" value="@value" />
</div>
</div>